﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace CommunitySystem
{
    public partial class BianZhiChaoBianWindow : ChildWindow
    {
        public int ID;
        public string Demo = "";
        private EmpbasicService.EmpBasicServiceClient Client = new EmpbasicService.EmpBasicServiceClient();
        public BianZhiChaoBianWindow(int id,string demo)
        {
            InitializeComponent();
            zongbianzhi.AcceptsReturn = true;
            zongbianzhi.TextWrapping = TextWrapping.Wrap;
            ID = id;
            Demo = demo;
            if(!string.IsNullOrEmpty(demo)) zongbianzhi.Text = demo;
            
            Client.UpdateBianZhi_JiBenModelCompleted += 
                new EventHandler<EmpbasicService.UpdateBianZhi_JiBenModelCompletedEventArgs>(Client_UpdateBianZhi_JiBenModelCompleted);
        }

        void Client_UpdateBianZhi_JiBenModelCompleted(object sender, EmpbasicService.UpdateBianZhi_JiBenModelCompletedEventArgs e)
        {
            SilverlightMessageBoxLibrary.Message.InfoMessage("保存成功！");
            this.DialogResult = true;
        }

        private void OKButton_Click(object sender, RoutedEventArgs e)
        {
            Client.UpdateBianZhi_JiBenModelAsync(ID, zongbianzhi.Text);
        }

        private void CancelButton_Click(object sender, RoutedEventArgs e)
        {
            this.DialogResult = true;
        }
    }
}
